/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package wggcth.persistencia.vo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author deusemar
 */
@Entity
@Table(name = "amostra", catalog = "wggcth", schema = "")
@NamedQueries({@NamedQuery(name = "Amostra.findAll", query = "SELECT a FROM Amostra a"), @NamedQuery(name = "Amostra.findByIdamostra", query = "SELECT a FROM Amostra a WHERE a.idamostra = :idamostra")})
public class Amostra implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IDAMOSTRA", nullable = false)
    private Integer idamostra;
    @JoinColumn(name = "IDEXPERIMENTO", referencedColumnName = "IDEXPERIMENTO", nullable = false)
    @ManyToOne(optional = false)
    private Experimento idexperimento;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "amostra")
    private Collection<DadosExperimento> dadosExperimentoCollection;

    public Amostra() {
    }

    public Amostra(Integer idamostra) {
        this.idamostra = idamostra;
    }

    public Integer getIdamostra() {
        return idamostra;
    }

    public void setIdamostra(Integer idamostra) {
        this.idamostra = idamostra;
    }

    public Experimento getIdexperimento() {
        return idexperimento;
    }

    public void setIdexperimento(Experimento idexperimento) {
        this.idexperimento = idexperimento;
    }

    public Collection<DadosExperimento> getDadosExperimentoCollection() {
        return dadosExperimentoCollection;
    }

    public void setDadosExperimentoCollection(Collection<DadosExperimento> dadosExperimentoCollection) {
        this.dadosExperimentoCollection = dadosExperimentoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idamostra != null ? idamostra.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Amostra)) {
            return false;
        }
        Amostra other = (Amostra) object;
        if ((this.idamostra == null && other.idamostra != null) || (this.idamostra != null && !this.idamostra.equals(other.idamostra))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "wggcth.persistencia.vo.Amostra[idamostra=" + idamostra + "]";
    }

}
